Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: preGSC

  1. #11
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    24
    Thanks
    4
    Thanked 16 Times in 10 Posts
    Quote Originally Posted by kung foo man View Post
    Do you just think that, because the code is shorter (not using helper-variables), or did you actually test it?
    Sadly I can't test that properly since I can't measure the passed milliseconds :/
    But if you know a way to do it (even maybe with server file), that'd be great to check.
    The only way I know is to execute it millions of times and check the hitch warning; but I think that's really not an exact solution.

  2. #12
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    24
    Thanks
    4
    Thanked 16 Times in 10 Posts
    Okay so now I have extended those preprocessor directives to be more useful, and also added some more things. Changelog:
    [+] Preprocessor directives
    [+] Inline functions
    [+] Foreach
    [+] Filled array and map definitions
    [+] Default parameters
    [+] Apostrophe strings
    [+] Importing
    [-] Handling more extreme conditions

    I hope it'll be useful for someone. Download: preGSC
    Please report every ideas and bugs.

    Also kung foo I have benchmarked many things, reference variables are really not useful when using as a constant (so not modifying the data structure itself), also sometimes helper variables are faster (I see no logic behind it, asked BraXi and Ninja and noone knows why, but these were the test results), so I have made inline functions with which we can save much copying (details on ModDB page - no real function call, it will be inserted in the code while compiling with preGSC); I have run 100000 times a removeFromArray function with normal function, and with inline. Normal was 4000ms, inline was 500ms... so thanks for the benchmarking idea.

  3. The Following 2 Users Say Thank You to iCore For This Useful Post:

    Jared (17th November 2013),kung foo man (17th November 2013)

  4. #13
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    I take it foreach doesnt work with string-arrays in cod2? For afaik there is no way to get all keys() from such an array...

  5. The Following User Says Thank You to IzNoGoD For This Useful Post:

    iCore (17th November 2013)

  6. #14
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    24
    Thanks
    4
    Thanked 16 Times in 10 Posts
    Quote Originally Posted by IzNoGoD View Post
    I take it foreach doesnt work with string-arrays in cod2? For afaik there is no way to get all keys() from such an array...
    Ooooooh, no getArrayKeys() in CoD2? :S
    Fuuuu

  7. #15
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    24
    Thanks
    4
    Thanked 16 Times in 10 Posts
    Quote Originally Posted by IzNoGoD View Post
    I take it foreach doesnt work with string-arrays in cod2? For afaik there is no way to get all keys() from such an array...
    Okay now (in a non-released version) I have enhanced foreach() in several ways. With the -zeroarrays parameter you'll be able to tell the program to generate 0-indexed loops instead of using getArrayKeys().
    Even if you are using -zeroarrays or not, you'll be able to pass parameters this way: foreach (player in level.players; 1; n) where 1 means the starting index, and n is size of the array. They are not compulsory, but if starting index is set, then nor without -zeroarrays will getArrayKeys be generated. Also there is must optimization based on much benchmarking, like creating pointer to an element if used more than 2 times inside the loop, etc.

    Now it may be a little meaningless description, but I'll serve many examples on the ModDB page when released, containing the usage of parameter and the details of optimizations too.

    By the way thanks for reporting that problem.

    Cheers.

  8. #16
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Hows the source, luke?
    timescale 0.01

  9. #17
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    24
    Thanks
    4
    Thanked 16 Times in 10 Posts
    I'll make that public when releasing the newest version soon
    But also that code will be ugly and shit for an experienced C++ programmer so don't be scared when you see that

  10. The Following User Says Thank You to iCore For This Useful Post:

    kung foo man (3rd December 2013)

  11. #18
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Click image for larger version. 

Name:	op.jpg 
Views:	46 
Size:	45.5 KB 
ID:	690
    (ten chars)
    timescale 0.01

  12. The Following 3 Users Say Thank You to kung foo man For This Useful Post:

    MeGaBooM (10th April 2014),Mitch (9th April 2014),smect@ (9th April 2014)

  13. #19
    Private First Class php's Avatar
    Join Date
    Nov 2012
    Posts
    142
    Thanks
    28
    Thanked 116 Times in 59 Posts

  14. The Following User Says Thank You to php For This Useful Post:

    Mitch (9th April 2014)

  15. #20
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    24
    Thanks
    4
    Thanked 16 Times in 10 Posts
    Lol sorry it was forgotten xD
    Here you are: preGSC source
    It is not done by a real compiler with lexical-syntax-semantical analysis, I wanted it to be as fast as possible.

  16. The Following 3 Users Say Thank You to iCore For This Useful Post:

    kung foo man (10th April 2014),Mitch (9th April 2014),php (9th April 2014)

Tags for this Thread

Posting Permissions

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