jkotlinski / durexforth

Modern C64 Forth
Other
233 stars 28 forks source link

Optimized signed multiplication words, re: Issue #194 #404

Closed burnsauce closed 2 years ago

burnsauce commented 2 years ago

Speed is within spitting distance of blazin' forth but adds some bytes to the core. M* with the same treatment might save them back.

burnsauce commented 2 years ago

Sadly, there's about a 20% speed decrease from specific machine code integrating tighter branching and internal negation.

The hand-rolled assembly is just that much more efficient than the forth-factored code. :(

jkotlinski commented 2 years ago

Humm... you mean 20% speed increase, or? Isn't that a good thing?

burnsauce commented 2 years ago

Uncommitted to this codebase, I had written a lower-level * in machine code (that replicated negate without the jsr. It was about 20% faster than the current commit, on-par with blazin'.

jkotlinski commented 2 years ago

Oops! Sorry.

On Wed, 5 Jan 2022 at 22:53, Poindexter Frink @.***> wrote:

@.**** commented on this pull request.

In forth_src/compat.fs https://github.com/jkotlinski/durexforth/pull/404#discussion_r779161489:

@@ -53,6 +53,7 @@ begin over c@ digit? over and while 1+ r> 1- repeat ;

\ from FIG UK +: ?negate 0< if negate then ;

It's used by SM/REM, just below.

— Reply to this email directly, view it on GitHub https://github.com/jkotlinski/durexforth/pull/404#discussion_r779161489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY34OYHCFBMQHLA3A4MGH3UUS4T7ANCNFSM5LI6EUQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

burnsauce commented 2 years ago

I think this is it for the multiplies. Bytes and cycles shaved, looks almost optimal to me.

burnsauce commented 2 years ago

Only marginally slower than blazin' forth on * and M* now, although durexforth's performance gap between * and M* is wider than blazin's.

jkotlinski commented 2 years ago

good to go?

burnsauce commented 2 years ago

Yep, all done!