Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 04:37 19 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM+ E100 with "Not enough memory"

     Page 3 of 5    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 11:07pm 04 May 2021
Copy link to clipboard 
Print this post

Gerry:
This will slow things down but should cover the case in question.
Ignoring wordwrap
For r=0 To replacecount-1
      For i=1 To Len(separators$)
        For j = 1 To Len(separators$)
        totalfile$=ReplaceString(totalfile$,Mid(separators$,j,1)+rep$( r,0)+Mid(separators$,i,1),Mid(separators$,j,1)+rep$( r,1)+Mid(separators$,i,1),#PB_String_NoCase )
      Next j
    Next i  
   
    Next r


Starting around line 462

(Untested)

Jim
VK7JH
MMedit   MMBasic Help
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 11:34pm 04 May 2021
Copy link to clipboard 
Print this post

I chuckled at your workaround disco4now - very cunning!!
Thanks for the suggestion. I vaguely remember doing things like that decades ago when I used a DEC Vax system for coding - grey matter not what it used to be!
It would be good if your mod works TassyJim, - one less thing to allow for.

My program is now quite large at 5482 lines and counting, with 2921 lines as code.
MMEdit seems to have slowed when saving or opening it with increasing size. It now takes about 16s to open, and about 40s to save, yet if I exit after an edit and say Yes to the "Oops!.. Do you want to save the changes?" it will save in a blink!

Do I have some setting wrong to cause this?

With regards, Paul.
Nothing so constant as change.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 03:10am 05 May 2021
Copy link to clipboard 
Print this post

  Bowden_P said  
My program is now quite large at 5482 lines and counting, with 2921 lines as code.
MMEdit seems to have slowed when saving or opening it with increasing size.
With regards, Paul.


MMEdit is written in an interpreted Basic so relatively slow.
One day, I will change over to PureBasic. (Some of the work is already done in helper files written in PureBasic.)

One thing you can do is set "Format Keyword Case" to "As is" in Preferences.




Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 06:03am 05 May 2021
Copy link to clipboard 
Print this post

Another source of slow saving:
As well as the normal .BAS file, MMEdit saves two other files.
First there is "lastfile.bas"  and then "lastfile.baz"
"lastfile.bas" is a copy of the last file and shouldn't be too slow but "lastfile.baz" runs through a MERGE and then CRUNCH before being saved. This will be slow.

These files make it easier to automate processes in external programs.

I will have a look at making saving these files as options.

Jim
VK7JH
MMedit   MMBasic Help
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 06:42am 05 May 2021
Copy link to clipboard 
Print this post

MMREPLACE.exe and MMREPLACE32.EXE updated with Jim's improved replace code.


MMReplace1_08.zip
Latest F4 Latest H7
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 09:25am 05 May 2021
Copy link to clipboard 
Print this post

Hi disco4now and TassyJim,
Many thanks for your posts. I'll be updating #REPLACE a bit later today.
Just checked the "Format KEYWORDS as" setting - it is "As is" !

( When saving a file the cursor does much flickering between the mouse pointer and the hour-glass symbol - just like a manual crunch does - your MERGE and CRUNCH in action.)

With regards, Paul.
Nothing so constant as change.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 02:41pm 05 May 2021
Copy link to clipboard 
Print this post

Hi TassyJim and disco4now,
I've been testing the mod - which works well on my troublesome strings!
With :-                          
 #replace Fn$ G$(1)       SELECT CASE Fn$+Md$+Stg$+Prt$  ->  SELECT CASE G$(1)+G$(2)+G$(3)+G$(4)
 #replace Md$ G$(2)
 #replace Stg$ G$(3)      Tx_Str$=Tx_Msg_Type$+Tx_Msg_Prt$  stays :- Tx_Str$=Tx_Msg_Type$+Tx_Msg_Prt$
 #replace Prt$ G$(4)

I thought I would try the arithmetic operators, and all was well except for "^", which it seems
a bit shy with.
With :-
 #replace Int1% I%(1)
 #replace Int2% I%(2)
this :-
 R%=Int1%^Int2%:R%=Int1% ^Int2%:R%=Int1%^ Int2%:R%=Int1% ^ Int2%
becomes :-
 R%=Int1%^I%(2):R%=I%(1) ^I%(2):R%=Int1%^ I%(2):R%=I%(1) ^ I%(2) ( MMReplaceDistribution\MMReplace32.exe )
 R%=Int1%^Int2%:R%=I%(1) ^Int2%:R%=Int1%^ I%(2):R%=I%(1) ^ I%(2) ( MMReplace_08\MMReplace32.exe )

The spaces help the replacement
With regards, Paul.
Nothing so constant as change.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 09:56pm 05 May 2021
Copy link to clipboard 
Print this post

Gerry,
^ missing from list of separators
separators$=" ,()-+/\*<>=!:'$&^" + specialseparators$+Chr(34)

should fix it.
You have included $ and !, perhaps you should have % as well?

Paul,
It is almost impossible to test for all programming styles and combinations so we depend on willing guinea pigs to help find the bugs.

Jim
VK7JH
MMedit   MMBasic Help
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 11:09pm 05 May 2021
Copy link to clipboard 
Print this post

Added addition separators as suggest by Jim.

MMReplace_1_09.zip

How much memory have you retrieved?


Gerry
Latest F4 Latest H7
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 12:13am 06 May 2021
Copy link to clipboard 
Print this post

Hi TassyJim and disco4now,
Yes - the 09 version of MMReplace 32 has fixed the "^" shyness ! Many thanks from your friendly guinea pig.

On memory saved, I have about 6K extra Flash and 5K extra RAM - both really useful gains! This does include some very small other edits too, but mostly just due to the #REPLACE technique. ( Code is always "Program - Crunch"'d, not "Auto Crunch on load".)

With regards, Paul.
Edited 2021-05-06 10:17 by Bowden_P
Nothing so constant as change.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 07:18am 06 May 2021
Copy link to clipboard 
Print this post

Paul,
I have updated the version on MMEdit on my website.
It would be interesting to see if there is much improvement in the saving and loading speeds.
There is  a new option in Preferences - create 'lastfile.bas'.
If you don't make use of that feature, leave it unselected.

Jim
VK7JH
MMedit   MMBasic Help
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 08:46pm 06 May 2021
Copy link to clipboard 
Print this post

Hi TassyJim,
I have run the v4.1.3, and the timings are :-

                v3.8.1      v4.1.3
Load           0:20         1:10   Full program, 5500 lines.
Save 1        0:42         0:01   Edited but complete version of the full program. !! Tremendous !!
Crunch        0:42         0:44   Full program down to 2964 lines. ( Takes 0:09 to load,)
#REPLACE   3:16         3:25   70 #REPLACES on Crunched code.
Save 2        0:21         0:20   Save of the Crunched and #REPLACE code.

The new #REPLACE is taking longer as predicted, I believe the old version took about 2:00.
I don't understand why Save 2 is much longer than the full program Save 1 !!
( These timings without any Anti-virus running.)

Looking at the Load timing, I am puzzled about that. I can't easily go back to check now.
( I'll recheck the current one however.)

Is there any chance you can work your magic on the Load timings !

I had 2 warning windows appear during all this activity, which you may find interesting :-
One said "SmallTalk/V out of memory. Unable to continue.", followed by an abrupt exit.

The other when I loaded an empty .bas file :- "Error : 0 System Primitive failed"
This time no crash out, and a repeat load was successful.

With regards, Paul.
Nothing so constant as change.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 10:07pm 06 May 2021
Copy link to clipboard 
Print this post

  Quote  I had 2 warning windows appear during all this activity, which you may find interesting :-
One said "SmallTalk/V out of memory. Unable to continue.", followed by an abrupt exit.

That error comes from the language that Liberty Basic was written in and MMEdit is written in Liberty Basic.
It suggests that we have reached the limit of the memory space allocated by the system. Not a lot can be done about that.

What version of Windows are you running?

I didn't realise you were using an old version of MMEdit.
There were a lot of changes since v3.8.1 but I can't see anything that would be affected by program size.

Jim
VK7JH
MMedit   MMBasic Help
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 11:31pm 06 May 2021
Copy link to clipboard 
Print this post

Hi TassyJim,
I have Win XP Professional with SP3, version 2002. ( Ha-ha, positively ancient in PC genealogy !!)

Looking at Save timings, it seems that a straight edit by MMEdit then Save - is "instant", but if I Crunch or run #REPLACE it takes a noticeable time - 4-7 secs. The 20s tabled above looks a bit pessimistic.

It is probably quicker to Crunch, #REPLACE, then Crunch again, rather than #REPLACE then Crunch. The method with 2 Crunches removes the commented #REPLACE residuals.

Had my 2nd. Covid jab 2 days ago and now feel rather tired, so I'll sign off for now before my typing gets too much of a struggle !

With regards, Paul.
Nothing so constant as change.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 01:31am 07 May 2021
Copy link to clipboard 
Print this post

Not a lot I can do with XP unfortunately.
I am working on a test version for you to play with which should give me some clues as to where the delay in loading is.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 05:18am 07 May 2021
Copy link to clipboard 
Print this post

I have added some timing markers to the program.
Either download again or just replace the MMEdit.tkn file in the program folder with the one in the ZIP

After running the new version, in the MMedit4.inf file, there will be a line just before the Recent files list
You can find the location of the Data folder from Help/About

showspeed = 0

change that to

showspeed = 1


Make the change with MMEdit shut down.

Next time you open a file, save a file or list the SUBs, a text file will get created with some timing data.
I can use that information to determine where the biggest slowdowns are.
That doesn't mean I can do anything about it!
The file gets overwritten with each test so make a copy before doing the next action.
The file gets opened up with you default txt viewer.

To stop the files getting created, change the inf line back to

showspeed = 0


MMedit.zip

Jim
VK7JH
MMedit   MMBasic Help
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 12:05pm 08 May 2021
Copy link to clipboard 
Print this post

Hi TassyJim,
I have 3 files from your MMEdit test version. They relate to default program load on opening MMEdit, and 2 saves - one a full program save, the other a save after crunch.

  Quote  Next time you open a file, save a file or list the SUBs, a text file will get created with some timing data.

Unable to find this feature.

Hope they help.

I tried a save of the Variable Report - which happened, but no test info came up.
( Interesting change of format from the old MMEdit 3.8.1 I was using. It spotted a missing bracket in a pair - very useful!)

With regards, Paul.
Nothing so constant as change.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 12:38pm 08 May 2021
Copy link to clipboard 
Print this post

Oops! Forgot to attach the files .....
Regards, Paul.
mmspeeds_default_prog_load and saves.zip
Nothing so constant as change.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 162
Posted: 07:03pm 08 May 2021
Copy link to clipboard 
Print this post

Hi disco4now and TassyJim,
It never ceases to amaze me how you can miss seeing the obvious, until it is eventually spotted,
then can't understand how it was ever missed!

disco4now,
I have been seeking a weird bug while using #REPLACE - here is what happened.

Subroutines F0() and F1() are calls listed below, operating on flags integer "F%".
( As per Captain Boing's flag manipulation scheme.)

Original source extract :-
=======================
 select case touch(ref)
   case Setup_Motr_Elec.Rd%
     F1(Motr_Elec.F%):F0(Motr_IC.F%):F0(Motr_Turbo.F%)
     
   case Setup_Motr_IC.Rd%
     F0(Motr_Elec.F%):F1(Motr_IC.F%):F0(Motr_Turbo.F%)
     
   case Setup_Motr_Turbo.Rd%
     F0(Motr_Elec.F%):F0(Motr_IC.F%):F1(Motr_Turbo.F%)
 end select

the SUB's F0() and F1() :-
=======================
sub F0(f_bit%)
 ' ----------
 ' Clear a flag bit in F%.
 F%=(F% or 1<<f_bit%) xor 1<<f_bit%
end sub
 
sub F1(f_bit%)
 ' ----------
 ' Set a flag bit in F%.
 F%=F% or 1<<f_bit%
end sub
 

and #REPLACE coding :-
===================
 #replace Motr_Elec.F% 57                       ' \
 #replace Motr_IC.F% 58                         ' |- Motor selection.
 #replace Motr_Turbo.F%  59    <<== 2 spaces!   ' /


#REPLACE'd and Crunched code :-
=============================
select case touch(ref)
case Setup_Motr_Elec.Rd%
F1(57):F0(58):F0()          <<== Empty ()
case Setup_Motr_IC.Rd%
F0(57):F1(58):F0()          <<==   "
case Setup_Motr_Turbo.Rd%
F0(57):F0(58):F1()          <<==   "
end select


Somehow :- "#REPLACE" "space" "variable_to_replace" "space" "number"          is fine,
but     :- "#REPLACE" "space" "variable_to_replace" "space" "space" "number"  is not!!

MMBasic doesn't error with no subroutine arguements, but I think that is expected.
I'd really appreciate a fix please!

TassyJim,
"Format" in the old MMEdit behaved slightly differently to the new version in that most commands were spaced out from the l.h.s by at least 1 tab (except for SUB/END SUB). The new version only does this on the first "nested" and following commands. I know this is a personal preference, but I found the old scheme helped when spotting missing or excess ENDIF's or NEXT's etc. ( I find Format and the Indent Guides very useful!)

Also the current line keeps getting "forgotten" if the screen is changed to view a .pdf for instance - or even a Variables Report. This seems to get worse as time passes using MMEdit! (If there is some text selected this does remain selected, but the line highlight is missing, so the scroll wheel doesn't work.)

With regards, Paul.
Nothing so constant as change.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 09:49pm 08 May 2021
Copy link to clipboard 
Print this post

Paul,
Thanks for the timing data.
It is obvious that the delay on loading is between markers 4 and 5



Referring to the above image.

Item 1. The right arrow toolbar button is the one to go to a selected subroutine. If you don't have any sub highlighted, it will instead open a window with the full list of subroutines/functions. It is a function I use a lot but does need to scan the full file each time so will be slow for large files.

The rest are preferences which need resetting after the version change.

Item 2. Unselect this and it might make a big difference to loading times. Either way, I will know a bit more about where the holdup is after you remove that option.

Item 3. This is the one that was causing the slow saving. Keep that unselected.

Item 4. This is the one that controls the initial indent. Select it to have the formatting back the way you liked it.

Jim
VK7JH
MMedit   MMBasic Help
 
     Page 3 of 5    
Print this page
© JAQ Software 2024