PHP Best Practices: Singletons (5/11)

preview_player
Показать описание

Official site

Twitter
Рекомендации по теме
Комментарии
Автор

hm, i wont argue with you but is not there a propose for singleton?
basicly the pattern made for maintining memory  better (if i know well but i cant be wrong)

so if i take a class and tell it to check another instances which equals themself then i return the current object instead of a new one will make us use less memory,

the question is how the complier handles this obviusly, beacuse i dont know exactly how php will create a new instace and use an existing one,

basic test case, with result of: 
Memory usage:248.328125
Memory usage:248.7265625
Run time: 0.043002128601074 seconds using singleton 
Memory usage:316.8515625
Run time: 1.4080808162689 seconds without using singleton

dteisen
Автор

Why your singleton class has public constructor ?

sergiiakimov
Автор

what is the screenrecording software you use?

JayeAesthetic
Автор

Can you tell me which font are u using in sublime text ?

hLENDR
Автор

I'm sorry but your arguments are all contradictory... what you say is bad is actually a benefit such as it being global.

This really is a poor description

Queekusme