Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#849 closed Feature Request (Rejected)

Optimization p2

Reported by: madflame991@… Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: optimization Cc:

Description

Why implement a Div() function?
1) It's a lot faster than basic a/b because it only returns the integer part of the result (floating point operations are A LOT SLOWER)
2) Precision is only needed in graphical/financial programs
3) Round(a/b) is slower... evidently
4) Mod() is already implemented, but it looks incomplete without Div()
5) It doesn't break backward compatibility

Attachments (0)

Change History (3)

comment:1 Changed 16 years ago by TicketCleanup

  • Version 3.3.0.0 deleted

Automatic ticket cleanup.

comment:2 in reply to: ↑ description Changed 16 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to closed

Replying to madflame991@…:

Why implement a Div() function?

Are you asking for a Div() function? It's not very clear...

1) It's a lot faster than basic a/b because it only returns the integer part of the result (floating point operations are A LOT SLOWER)

Your benchmarks? Because my simple benchmarks shows floating point division being nearly 4 times faster than integer division in a simple C++ program.

2) Precision is only needed in graphical/financial programs

Wow, that's an incredibly short-sighted statement.

3) Round(a/b) is slower... evidently

Well, Round() isn't the right thing anyway. Try Int(). Either way, I find performance to be acceptable casting with Int(). If you don't, then chances are this isn't the right language for your task to begin with.

4) Mod() is already implemented, but it looks incomplete without Div()

Mod() is implemented as a function because we didn't make it an operator. Division has an operator, there's no reason to add a function for it.

5) It doesn't break backward compatibility

It doesn't add anything useful, either. Does casting to an int slow things down? Sure, but not enough to be an issue. Not until you get in the hundreds of thousands of calculations. But when you start getting that high, you're probably using the wrong language anyway.

comment:3 Changed 16 years ago by madflame991@…

Your benchmarks? Because my simple benchmarks shows floating point division being nearly 4 times faster than integer division in a simple C++ program.

This is... how did you get to be a dev??? You don't know how a/b is translated from C++ to ASM?!? C++ does the floating point operation, then it converts it to an integer... IT'S EVIDENT IT TAKES MORE TIME TO TRUNCATE IT! WOW!!!
Try it in Assembler or Pascal! Did you ever touched anything than c++?
Before the arithmetical coprocessor was invented, the main CPU had to crunch all the floating point arithmetics; even if we have the coprocessor now it's still slower to calculate useless digits...

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.