Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The example I'm talking about is the first non-trivial example in the readme - 34 lines of believable code, not an individual function of the library.

The library is used about once every 3.5 lines, which feels less dense than most jQuery code I see, but that whole function runs 3 times slower than the plain MB-aware equivalent.

Some of the library functions might be implemented inefficiently but from a quick glance they're nearly all very thin wrappers.

Overhead from libraries like Symfony and ZF is quite acceptable since they offer much higher level features which you'd have to code yourself otherwise.

However making all your code (excluding I/O) run up to 3 times slower, just to add some syntactic sugar, is insane.



What causes the overhead? Is there a way to get the sugar without the calories?


A trivial example:

  $len = mb_strlen("wtf");
    # call function mb_strlen

  $len = s("wtf")->len();
    # call function s
      # allocate string object
      # instantiate string object
      # call string ctor
        # set property
    # call method len
        # get property
      # call function mb_strlen
    # destroy object
There's no way to use a syntax like this without either massive overhead, or massive changes in the engine.

There is a somewhat similar experimental project - https://github.com/nikic/scalar_objects - but that's not meant for real world use either.

Personally I think the language, despite its flaws, does its job fine. I don't think it needs turning into Javascript-with-sigils.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: