Dear gnoga folks,
I'm seeing some poor performance behavior in Gnoga.Gui.Element.Create_From_HTML
when the created HTML is long enough (say 1Mb in my computer) I use that to
insert generated SVG inside the DOM.
Trying to understand what was going on, I tried with HTML of different sizes
and the there was a threshold value about 500Kb. The function procedure was
very poorly performant above that: it took more than one minute process 2Mb
generated HTML. A look inside the function revealed that most of the time was
consumed by Escape_Quotes, by the concatenation by assignation performed there.
Changing this reasignation by using Ada.Strings.Unbounded.Append solves the
issue making disappear the time lag. I attach the (very simple) patch for your
consideration. It works for me and I hope it was useful for everyone.
Many thanks,
Best Regards
Miguel Oliván
From 8cad35edabfcca5bc020fb778f677ae590f81514 Mon Sep 17 00:00:00 2001
From: Miguel Olivan <maoli...@fcirce.es>
Date: Wed, 30 Aug 2017 12:02:37 +0200
Subject: [PATCH] Use Ada.Strings.Unbounded.Append instead String reasignation
concat in Escape_Quotes and Unescape_Quotes
---
src/gnoga.adb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gnoga.adb b/src/gnoga.adb
index 6be4e39..751ae4a 100644
--- a/src/gnoga.adb
+++ b/src/gnoga.adb
@@ -75,7 +75,7 @@ package body Gnoga is
R : Ada.Strings.Unbounded.Unbounded_String;
begin
for C in S'Range loop
- R := R & Translate_Character (S (C));
+ Ada.Strings.Unbounded.Append(R , Translate_Character (S (C)));
end loop;
return Ada.Strings.Unbounded.To_String (R);
@@ -121,7 +121,7 @@ package body Gnoga is
R : Ada.Strings.Unbounded.Unbounded_String;
begin
loop
- R := R & Translate_Character;
+ Ada.Strings.Unbounded.Append( R ,Translate_Character);
exit when C > S'Last;
end loop;
--
2.11.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list