Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-717

Do not use files when using proxy autogeneration

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Proxy classes are generated in less than 1ms for me. I prefer to not have a "build" step to reducing loading time by a milisecond, so I use autogenerate.

      For users like me, wouldn't it be nicer if we wouldn't even have to configure a proxy dir and those files were never written (since they're not read more than once anyway)?

        Activity

        Hide
        Benjamin Eberlei added a comment -

        you should know though, eval is dead slow. It generates the necessary proxies on EACH request and that cannot be cached in APC.

        Show
        Benjamin Eberlei added a comment - you should know though, eval is dead slow. It generates the necessary proxies on EACH request and that cannot be cached in APC.
        Hide
        Jaka Jancar added a comment -

        It's no slower than current autogeneration (file_put_contents+require). TBH, I don't know why anyone would want to use that over eval(), but I don't mind it being there.

        Pre-generation is, of course, a different thing. Seems like a valid tradeoff to offer: build/a bit of config/better perfomance vs. no build/no config/potentially slower.

        Show
        Jaka Jancar added a comment - It's no slower than current autogeneration (file_put_contents+require). TBH, I don't know why anyone would want to use that over eval(), but I don't mind it being there. Pre-generation is, of course, a different thing. Seems like a valid tradeoff to offer: build/a bit of config/better perfomance vs. no build/no config/potentially slower.
        Hide
        Benjamin Eberlei added a comment -

        Yes, that is because file_put_contents + require is a development only strategy. The manual clearly states that autogenerate has to be false in production.

        Show
        Benjamin Eberlei added a comment - Yes, that is because file_put_contents + require is a development only strategy. The manual clearly states that autogenerate has to be false in production.
        Hide
        Roman S. Borschel added a comment -

        Using eval() instead of producing and requiring the file in the case of enabled auto-generation of proxy classes sounds like a good improvement for 2.1 to make proxies more transparent during deveopment and for anyone for whom performance is no issue.

        I'm increasing the priority as I think it is easy to implement for 2.1 and a good enhancement.

        Show
        Roman S. Borschel added a comment - Using eval() instead of producing and requiring the file in the case of enabled auto-generation of proxy classes sounds like a good improvement for 2.1 to make proxies more transparent during deveopment and for anyone for whom performance is no issue. I'm increasing the priority as I think it is easy to implement for 2.1 and a good enhancement.
        Hide
        Karsten Dambekalns added a comment -

        A note on why having the proxies written to a file can be useful even with autogenerate being on: it makes it really easy to check the proxy code being generated. I use that a lot currently.

        The solution suggested, giving three possibilities is cool, though.

        Show
        Karsten Dambekalns added a comment - A note on why having the proxies written to a file can be useful even with autogenerate being on: it makes it really easy to check the proxy code being generated. I use that a lot currently. The solution suggested, giving three possibilities is cool, though.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Jaka Jancar
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: