Porphyrin units are a kind of ideal electron donor units, which have large π conjugation and well-defined planar and electron-rich structures. The inserted alkynyl π bridges between porphyrin units and anhydride moieties can effectively enlarge the π-electron delocalization and molecular dimension effect and thus enhance the electron-donating ability and reduce the dipole moment in the porphyrin-based hyperbranched polyimides (HBPIs). The synergy effect of porphyrin units and alkynyl π bridges can facilitate the charge-transfer formation and dissociation, realize the transformation of memory type, and shorten the retention time of HBPI-TAPEPP-6FDA-based memory devices. The HBPI-TAPEPP-6FDA-based memory devices manifest lower threshold voltages of −2.32 and 2.42 V, a higher ON/OFF current ratio up to 10 7 , and a shorter retention time of ∼20 s.