SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: 1000 functions

  1. #1
    SitePoint Enthusiast duckax's Avatar
    Join Date
    Aug 2005
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy 1000 functions

    Lets say I have a script with 1000 functions. However, every time the script executes, only around 50 of the functions are used. What is the best way to implement something like this? Main consideration is performance.

    Solutions:
    1. Load all 1000 functions and have a 1.3 MB script. Problem: memory hog.

    2. Put the functions in 1000 different files and include() when I need them. Problem: accessing 50 different files every execution.

    3. Put the functions in a SQL DB and eval() when I need them. Problem: eval() is slow and chunky. SQL is just excess luggage.

    Anything I have not thought of?

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2005
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    strip out the 950 that are not used

  3. #3
    SitePoint Enthusiast duckax's Avatar
    Join Date
    Aug 2005
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol. The problem is that i'm not sure which 50 would be used. A different 50 will be used everytime and there is no way of knowing before hand.

  4. #4
    SitePoint Addict
    Join Date
    Aug 2002
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could probably separate those functions that are related to each other in a class.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •