Slow startup fixed, more TODO items!

The slow startup of Drawing was being caused by a “broken” regular expression, which was causing the text search it was used in to try using up too much of one resource or another (eg: stack space) and throw an exception (after ~20 seconds on my machine). There was a try/catch around that particular chunk of code, which essentially just kept the program quietly running.

Anyways, to get it going again I changed:

"<text.*?font-size:(.*?)px.*?x=\"(.*?)\".*?y=\"(.*?)\".*?freecad:editable=\"(.*?)\".*?<tspan.*?>"

into:

// Regex e1 attempts to find:
// [0] - A text tag that contains "freecad:editable=", and it's matching tspan tag
// [1] - positive integer font size in px
// [2] - pos/neg float x coordinate
// [3] - pos/neg float y coordinate
// [4] - one or more character Perl "word" for freecad:editable value
...
"<text.*?font-size:([\\d]+)px.*?x=\"([\\d.-]+)\".*?y=\"([\\d.-]+)\".*?freecad:editable=\"(\\w+)\".*?>.*?<tspan.*?"

Now, we get a much faster load, and the beginnings of another working feature! Now, we’ve got editable text boxes for the title, author, scale, etc. as encoded in the drawing templates. Of course, all this will require a fair bit more work before it’s ready to go…

Screen Shot 2015-04-05 at 11.05.12 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s