SetPVarInt / GetPVarInt vs Normal Vars.
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
Not sure where you got 20% from, my estimate would have been closer to 2000% slower - they are function calls instead of pawn operations (opcodes), a since a single function call takes multiple opcodes, they can't be that close. How far off are they? I did some tests:

https://gist.github.com/Y-Less/7f815...ece8386cfbfe28

Results:

Код:
  ||========================||
  || STARTING PROFILINGS... ||
  ||========================||

Timing "ReadGVars"...
          Mean = 4541.00ns
          Mode = 4556.00ns
        Median = 4556.00ns
         Range = 188.00ns

Timing "ReadGlobals"...
          Mean = 268.00ns
          Mode = 268.00ns
        Median = 268.00ns
         Range = 5.00ns

Timing "ReadLocals"...
          Mean = 285.00ns
          Mode = 284.00ns
        Median = 284.00ns
         Range = 8.00ns

Timing "ReadPVars"...
          Mean = 3918.00ns
          Mode = 3920.00ns
        Median = 3920.00ns
         Range = 26.00ns

Timing "ReadProperties"...
          Mean = 6791.00ns
          Mode = 6788.00ns
        Median = 6788.00ns
         Range = 26.00ns

Timing "ReadSVars"...
          Mean = 3823.00ns
          Mode = 3823.00ns
        Median = 3823.00ns
         Range = 24.00ns

Timing "WriteGVars"...
          Mean = 5755.00ns
          Mode = 5741.00ns
        Median = 5753.00ns
         Range = 40.00ns

Timing "WriteGlobals"...
          Mean = 257.00ns
          Mode = 255.00ns
        Median = 255.00ns
         Range = 21.00ns

Timing "WriteLocals"...
          Mean = 282.00ns
          Mode = 281.00ns
        Median = 281.00ns
         Range = 20.00ns

Timing "WritePVars"...
          Mean = 4122.00ns
          Mode = 4120.00ns
        Median = 4117.00ns
         Range = 57.00ns

Timing "WriteProperties"...
          Mean = 9890.00ns
          Mode = 9836.00ns
        Median = 9850.00ns
         Range = 243.00ns

Timing "WriteSVars"...
          Mean = 4188.00ns
          Mode = 4168.00ns
        Median = 4182.00ns
         Range = 63.00ns

*** Profilings: 12

  ||======================||
  || PROFILINGS COMPLETE! ||
  ||======================||
So only about 1400% slower. They do have important uses, and should be chosen where appropriate, but they should not be the default. Bear in mind, I did each version 30 times to get vaguely measurable results. Also note that these are VERY rough - they show good trends since the differences are so extreme, but they are not perfectly precise. I'd say 10x slower is a good estimate of a lower-bound for the difference, but computers and other effects can alter those numbers up or down a lot.
Wow, ty for this information.
Reply


Messages In This Thread
SetPVarInt / GetPVarInt vs Normal Vars. - by kingmk - 27.10.2017, 13:40
Re: SetPVarInt / GetPVarInt vs Normal Vars. - by 0x88 - 27.10.2017, 13:45
Re: SetPVarInt / GetPVarInt vs Normal Vars. - by kingmk - 27.10.2017, 13:48
Re: SetPVarInt / GetPVarInt vs Normal Vars. - by kingmk - 28.10.2017, 22:14

Forum Jump:


Users browsing this thread: 1 Guest(s)