DIB performance test MAX 2025

DIB performance test MAX 2025

denisT.MaxDoctor
Advisor Advisor
1,153 Views
11 Replies
Message 1 of 12

DIB performance test MAX 2025

denisT.MaxDoctor
Advisor
Advisor

There are several ways in MXS how to get a snapshot of the viewport. Could anyone make a test for me in MAX 2025, please:

could anyone make a test for me on MAX 2025, please?

--1:
(
	t0 = timestamp()
	h0 = heapfree

	for k=1 to 100 do
	(
gw.getviewportdib capturealpha:on gammacorrect:on
	)

	format "1 time:% heap:%\n" (timestamp() - t0) (h0 - heapfree)
)

--2:
(
	t0 = timestamp()
	h0 = heapfree

	for k=1 to 100 do
	(
viewport.getviewportdib capturealpha:on gammacorrect:on
	)

	format "2 time:% heap:%\n" (timestamp() - t0) (h0 - heapfree)
)

--3:
(
hwnd = viewport.gethwnd()
	t0 = timestamp()
	h0 = heapfree

	for k=1 to 100 do
	(
windows.snapshot hwnd capturealpha:on gammacorrect:on
	)

	format "3 time:% heap:%\n" (timestamp() - t0) (h0 - heapfree)
)

 

I want to check a difference from version to version. Thanks

0 Likes
Accepted solutions (1)
1,154 Views
11 Replies
Replies (11)
Message 2 of 12

inquestudios
Enthusiast
Enthusiast

1 time:5440 heap:39188L
OK
2 time:14861 heap:38128L
OK
3 time:13943 heap:38128L
OK

Message 3 of 12

denisT.MaxDoctor
Advisor
Advisor

@inquestudios wrote:

1 time:5440 heap:39188L
OK
2 time:14861 heap:38128L
OK
3 time:13943 heap:38128L
OK


Thank you.

 

The speed is about 10 times slower than expected... I need more tests to draw any conclusion.

 

Can anyone else run a test, please?



0 Likes
Message 4 of 12

RGhost77
Advisor
Advisor
1 time:4338 heap:39508L
OK
2 time:13933 heap:40256L
OK
3 time:15255 heap:38128L
OK

2025.2


Royal Ghost | veda3d.com
Message 5 of 12

denisT.MaxDoctor
Advisor
Advisor

here are my numbers for different versions:
2020

1 time:1522 heap:82152L
OK
2 time:2737 heap:82136L
OK
3 time:2313 heap:82136L
OK

 

2023

1 time:1085 heap:82136L
OK
2 time:2017 heap:82140L
OK
3 time:1708 heap:82128L
OK

 

 

I see something wrong in 2025!

0 Likes
Message 6 of 12

denisT.MaxDoctor
Advisor
Advisor

Could anyone give the numbers to the other versions, please?

 

Wait!
Let's make the contest fair:

 

--1:
(
	t0 = timestamp()
	h0 = heapfree
d
	for k=1 to 100 do
	(
d = gw.getviewportdib capturealpha:on gammacorrect:on
	)

	format "1 dim:% time:% heap:%\n" [d.width, d.height] (timestamp() - t0) (h0 - heapfree)
)

--2:
(
	t0 = timestamp()
	h0 = heapfree
d
	for k=1 to 100 do
	(
d = viewport.getviewportdib capturealpha:on gammacorrect:on
	)

	format "2 dim:% time:% heap:%\n" [d.width, d.height] (timestamp() - t0) (h0 - heapfree)
)

--3:
(
hwnd = viewport.gethwnd()
	t0 = timestamp()
	h0 = heapfree
d
	for k=1 to 100 do
	(
d = windows.snapshot hwnd capturealpha:on gammacorrect:on
	)

	format "3 dim:% time:% heap:%\n" [d.width, d.height] (timestamp() - t0) (h0 - heapfree)
)

 

We have to know the viewport size 

 





0 Likes
Message 7 of 12

har1sf0x
Advocate
Advocate

2019

1 dim:[835,394] time:605 heap:80540L
OK
2 dim:[835,394] time:971 heap:80528L
OK
3 dim:[835,394] time:777 heap:80544L
OK

2023

1 dim:[798,371] time:802 heap:82136L
2 dim:[798,371] time:1229 heap:82136L
3 dim:[798,371] time:1147 heap:82136L

2024 - getting worse every time

1 dim:[1089,387] time:2154 heap:38556L
2 dim:[1089,387] time:5720 heap:38136L
3 dim:[1089,387] time:6304 heap:38136L
1 dim:[1089,387] time:5613 heap:38136L
2 dim:[1089,387] time:11333 heap:38136L
3 dim:[1089,387] time:12112 heap:38164L
1 dim:[1089,388] time:9475 heap:38136L
2 dim:[1089,388] time:19497 heap:38164L
3 dim:[1089,388] time:26307 heap:38188L
1 dim:[1089,388] time:18524 heap:38136L
2 dim:[1089,388] time:32455 heap:38136L
3 dim:[1089,388] time:32200 heap:38136L
1 dim:[1089,387] time:19864 heap:38136L
2 dim:[1089,387] time:37728 heap:38136L
3 dim:[1089,387] time:39135 heap:38136L

  

Message 8 of 12

denisT.MaxDoctor
Advisor
Advisor

2024 - getting worse every time


There is a possible explanation for this - we create a new bitmap every time and don't free it. But... I don't see this behavior, at least not in 2020.

Well, we can free bitmaps, but we have to understand that it takes time too:

 

gammacorrect = off

--1:
(
	t0 = timestamp()
	h0 = heapfree
d
	for k=1 to 100 do
	(
d = gw.getviewportdib capturealpha:on gammacorrect:gammacorrect
free d
	)

	format "1 dim:% time:% heap:%\n" [d.width, d.height] (timestamp() - t0) (h0 - heapfree)
)

--2:
(
	t0 = timestamp()
	h0 = heapfree
d
	for k=1 to 100 do
	(
d = viewport.getviewportdib capturealpha:on gammacorrect:gammacorrect
free d
	)

	format "2 dim:% time:% heap:%\n" [d.width, d.height] (timestamp() - t0) (h0 - heapfree)
)

--3:
(
hwnd = viewport.gethwnd()
	t0 = timestamp()
	h0 = heapfree
d
	for k=1 to 100 do
	(
d = windows.snapshot hwnd capturealpha:on gammacorrect:gammacorrect
free d
	)

	format "3 dim:% time:% heap:%\n" [d.width, d.height] (timestamp() - t0) (h0 - heapfree)
)

 

 

Let's add “optional gamma correction”... but I don't see a significant difference between “with” and “without”.

0 Likes
Message 9 of 12

denisT.MaxDoctor
Advisor
Advisor

Looking at the numbers, I think it's obvious that 2024 and 2025 do this job slower. Right?

0 Likes
Message 10 of 12

har1sf0x
Advocate
Advocate
I did the same number of test on the other versions, as far as I can remember it was much closer and not always worse. In 2024 every time was going up in time. I'll try your freeing code tomorrow and post multiple (x5) for the above installed versions that I have.
Message 11 of 12

denisT.MaxDoctor
Advisor
Advisor

👍

0 Likes
Message 12 of 12

har1sf0x
Advocate
Advocate
Accepted solution

Good morning.

My tests on my laptop with windows 11.

I do not know if the dimensions play so much role. I observe that 2019, 2023 give stable results using big heap while is the opposite for 2024, small heap usage and skyrocketed time.

Enjoy!

2019

1 dim:[835,394] time:1100 heap:80468L
2 dim:[835,394] time:1098 heap:80488L
3 dim:[835,394] time:812 heap:80480L
1 dim:[835,394] time:655 heap:80468L
2 dim:[835,394] time:1022 heap:80472L
3 dim:[835,394] time:1009 heap:80468L
1 dim:[835,394] time:899 heap:-682736L
2 dim:[835,394] time:1024 heap:80468L
3 dim:[835,394] time:863 heap:80468L
1 dim:[835,394] time:623 heap:80488L
2 dim:[835,394] time:1059 heap:80480L
3 dim:[835,394] time:801 heap:80468L
1 dim:[835,394] time:729 heap:80472L
2 dim:[835,394] time:1228 heap:80468L
3 dim:[835,394] time:946 heap:-578588L

2023

1 dim:[798,371] time:884 heap:82068L
2 dim:[798,371] time:1474 heap:82068L
3 dim:[798,371] time:1387 heap:82068L
1 dim:[798,371] time:889 heap:82068L
2 dim:[798,371] time:1619 heap:82068L
3 dim:[798,371] time:1443 heap:82068L
1 dim:[798,371] time:834 heap:82068L
2 dim:[798,371] time:1524 heap:82068L
3 dim:[798,371] time:1325 heap:82068L
1 dim:[798,371] time:875 heap:82068L
2 dim:[798,371] time:1642 heap:82068L
3 dim:[798,371] time:1439 heap:82068L
1 dim:[798,371] time:918 heap:82068L
2 dim:[798,371] time:1556 heap:82068L
3 dim:[798,371] time:1477 heap:82068L

2024

1 dim:[1089,388] time:2534 heap:38480L
2 dim:[1089,388] time:6106 heap:38068L
3 dim:[1089,388] time:7502 heap:38068L
1 dim:[1089,388] time:5505 heap:38068L
2 dim:[1089,388] time:14941 heap:38068L
3 dim:[1089,388] time:18172 heap:38096L
1 dim:[1089,388] time:10772 heap:38068L
2 dim:[1089,388] time:24687 heap:38068L
3 dim:[1089,388] time:28194 heap:38096L
1 dim:[1089,388] time:20997 heap:38092L
2 dim:[1089,388] time:34444 heap:38096L
3 dim:[1089,388] time:35325 heap:38068L
1 dim:[1089,388] time:24050 heap:38068L
2 dim:[1089,388] time:41893 heap:38068L
3 dim:[1089,388] time:43437 heap:38068L

 

0 Likes