Slug #687
Builtin fn makes unnecessary copy of arg
Status:
Closed
Priority:
Normal
Assignee:
Category:
enhancing/improving
Target version:
Description
While testing/profiling IndetsIn
(defined in BuiltinOneLiners.C
) I noticed that the arg was copied by the fn, making it needlessly slow.
Investigate!
Related issues
History
#1 Updated by John Abbott about 9 years ago
I ran the following test:
f := x+y+z+1; f99 := f^99; // this is slow (~10s on my machine) t0 := CpuTime(); for i := 1 to 100 do NoPrint := IndetsIn(f99); endfor; println "Loop time: ", TimeFrom(t0);
This reports a loop time of almost 10s.
An essentially identical test in CoCoALib is too fast to measure (less than 0.001s).
So the "overhead" is more than 99% -- wholly unacceptable!
#2 Updated by John Abbott almost 3 years ago
- Status changed from New to Closed
- Assignee set to John Abbott
- Target version changed from CoCoA-5.?.? to CoCoA-5.4.0
- % Done changed from 0 to 100
- Estimated time set to 0.75 h
Now it takes 0.001s. No idea why it is fast now and not before.
Closing.
#3 Updated by Anna Maria Bigatti almost 3 years ago
John Abbott wrote:
Now it takes 0.001s. No idea why it is fast now and not before.
I guess is was for the move constructor
RingElem(RingElem&& copy); // move ctor
defined in ring.H
// Revision 1.63 2020/10/05 19:30:31 abbott // Summary: Added move ctor