Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.sys.cbm    |    Discussion about Commodore micros    |    53,866 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 52,236 of 53,866    |
|    Shaun Bebbington to Janne Johansson    |
|    Re: C64 BASIC - what's faster INT() or %    |
|    19 Apr 18 01:14:37    |
      From: shaun@square-circle.co.uk              On Thursday, 19 April 2018 08:14:28 UTC+1, Janne Johansson wrote:       > On 2018-04-18 09:37, Shaun Bebbington : Janne Johansson wrote:       > > On Wednesday, 18 April 2018 16:41:28 UTC+1, Janne Johansson wrote:       > >> On 2018-04-18 05:38, Shaun Bebbington : All wrote:       > >> > Thanks for the hints all. I'll do some bench mark testing or       > >> whatever :-)       > >>       > >> Please do. If benchmarking with a FOR loop over hundreds or thousands of       > >> repetitions is too hard to figure it out, then the answer isn't really       > >> important.       > >       > > Hey! Good hint.       >        > I noticed (after sending of course) that it may have been perceivable as       > a harsh statement, hinting at lazyness or something, I meant more along       > the lines of "if you try 100 loops and can't make out the difference,       > then try 1000 loops then try 10k loops and so on, the difference might       > be so small that its not worth coding your BASIC programs with %       > sprinkled here and there for optimization reasons, but just go for       > normal ordinary readability and simplicity since performance is then       > bound by something else like algorithmic complexity and not the one-time       > conversions from ints to floats and back".       >        > If you really need a basic program to run faster, there are a lot of       > compilers that pre-calculate and pre-parse and then make some kind of       > machine language equivalent program out of it which you can run and       > which will be lots faster. If that isn't fast enough still, code       > important parts in ASM directly or at least code it up in CC65 using       > C for some middle ground between compiled BASIC and doing it all in       > ASM yourself.              Yes Blitz BASIC seems to do a reasonably good job at this. As for C, well I       love C. My thinking is like this: optimize BASIC, then compile. That should       get the best results.              Regards,              Shaun.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca