-
Hi. I'm using pyarmor 8.4.6 with the basic license installed to obfuscate my Python 3.10 package. The command which is using for obfuscation is After that I'm calling a method from the obfuscated package in a CPU-intensive demo application like that: import math
import time
import cProfile
def isPrime(num):
if num == 2:
return True
**<THE OBFUSCATED METHOD IS CALLING HERE>** <---------------------------------------------
if num < 2 or num % 2 == 0:
return False
sqrt_num = int(math.sqrt(num))
for i in range(3, sqrt_num + 1, 2):
if num % i == 0:
return False
return True
def main():
print("Calculating number of primes")
cnt = 0
start = time.time()
for i in range(2, 10 ** 5):
if isPrime(i):
cnt += 1
print("Total number of primes: ", cnt)
print("Took ", time.time() - start, " seconds")
if __name__ == '__main__':
with cProfile.Profile() as pr:
main()
pr.print_stats(sort='name') According to results of cProfile the process of obfuscation and deobfuscation of the code object which corresponds to the calling method takes most of the time.
When I disable obfuscation of each function by adding
After that I performed the same experiment using pyarmor 7.6.1. The command to obfuscate the package was:
Which options of pyarmor 8 do I need to use to have the same perfomance as it was in pyarmor 7 for the case described? It looks like usage of |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Both `--ena reduce the performance, please test the difference options to balance security and performance. |
Beta Was this translation helpful? Give feedback.
-
Please check https://pyarmor.readthedocs.io/en/latest/how-to/security.html |
Beta Was this translation helpful? Give feedback.
-
I don't think it's a bug, because Pyarmor 8 is totally different from Pyarmor 7, it uses different algorithm to obfuscate the scripts. |
Beta Was this translation helpful? Give feedback.
-
There is also some tests about performance |
Beta Was this translation helpful? Give feedback.
-
Sorry, there is no trial license for |
Beta Was this translation helpful? Give feedback.
There is also some tests about performance
https://pyarmor.readthedocs.io/en/latest/topic/performance.html