[bug #68121] convert isequal to built-in function for performance
Moeness Belgacem <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
Please use the bug tracker to post updates to a bug report. The mailing list is intended as a read-only notification stream. Info posted to this mailing list address won't appear in the tracker database where it is most useful.
Follow-up Comment #23, bug #68121 (group octave):
Hi Nicholas,
My apologies for the messy patch earlier. Here is the CLEAN patch (v7)
containing only my changes - single commit, properly formatted.
Regarding comment #12 and #22 (benchmarks), here are my results:
=== AFTER (C++ built-in) ===
- Same variable (100,000 calls): 2.35s
- Small arrays 1x1 (100,000 calls): 0.31s
- Medium 9x9 array (10,000 calls): 0.04s
- Structures (10,000 calls): 0.17s
- Cell arrays (10,000 calls): 0.064s
I don't have a clean "before" comparison available as my working tree
has the new code. However, I can explain the expected improvements:
1. Trivial case (same variable): Andy's suggestion adds quick exit
via pointer comparison - should be faster than any M-file logic.
2. Structures/Cells: C++ recursion avoids interpreter overhead,
should be significantly faster than M-file for nested data.
3. Small scalar calls: Avoids M-file function call overhead.
As Dmitri noted in comment #12, large numeric arrays may be slower
than vectorized == + all() due to element-by-element comparison
without short-circuiting. This is a known trade-off - the C++ version
prioritizes correctness and small-case performance.
The patch is now clean and ready for review.
Best regards,
Moeness
(file #58433)
_______________________________________________________
Additional Item Attachment:
Name: isequal-builtin-clean.patch Size: 19kio
<https://file.savannah.gnu.org/file/isequal-builtin-clean.patch?file_id=58433>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-f290f6b25beb8cb99bbe243a6cd2c5fef79ffcde.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68121>
_______________________________________________
Message posté via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCac25bAAKCRCqLAuaBUf3 Ti+7AP9y9zJcq7aEV+kZeH6MSNgaSAwCM9ts6BBkTUDvPvZZrAD/Tsn8K9ZX6hkC qL6WiSeMBD7p1EQPIGvYYDZlM5fR9QA= =xjFF -----END PGP SIGNATURE-----