Author Topic: Idea for improving performance  (Read 122 times)

i Z !

  • Member
  • **
  • Posts: 125
    • Customizable digital arts
Idea for improving performance
« on: October 05, 2020, 08:42:28 AM »
An idea which I will probably implement in my editor:

Let's say you have
Code: [Select]
.data
v1 dq 0
v2 dq 0
v3 dd 0
;and more variables
;...

.code

p1 proc
;...
mov rax, v1
;...
p1 endp

p2 proc
;...
p2 endp

p3 proc
;...
lbl1:
;...
lbl2:
;...
lbl3:
;...
p3 endp
;...


After pressing some sort of magic button, the editor would insert lines as shown below:

Code: [Select]
.data
v1 dq 0
v2 dq 0
v3 dd 0
;and more variables
;...

counter_p1 dq 0
counter_p2 dq 0
counter_p3 dq 0
 counter_v1 dq 0
 counter_v2 dq 0
 counter_v3 dq 0
 ;...
counter_p3_lbl1 dq 0
counter_p3_lbl2 dq 0
counter_p3_lbl3 dq 0
;...

.code

p1 proc
inc counter_p1
;...
mov rax, v1
inc counter_v1
;...
p1 endp

p2 proc
inc counter_p2
;...
p2 endp

p3 proc
inc counter_p3

;...
lbl1:
inc counter_p3_lbl1
;...
lbl2:
inc counter_p3_lbl2
;...
lbl3:
inc counter_p3_lbl3
;...
p3 endp

endProc proc
;write counter's data to file
endProc endp


Then you would know which variables and procedures are accessed the most and you could then replace those variables(and labels) with registers:


Code: [Select]
.data
;for example if v1 and v3 are the most accessed variables:
v1 equ R8
v2 dd 0
v3 equ R9d
;...

I bit a bit,
got bites from bytes.
I'll ram'em back in their RAM
and machine-gun the shit out of their f*in machine...

Try out my Automatized ASM Editor for Windows 10 for 30 days. Also visit silverfox.systems/ace!