Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow execution time when running inside Docker container on a M1 CPU (aarch64) #1

Open
david224-ic opened this issue Jul 19, 2024 · 0 comments

Comments

@david224-ic
Copy link

What happened?

I noticed that after implementing envkey-php in my project page loading got at lot slower only when running inside my Docker container (I'm on and M1 Mac).
I decided to take a look at what was causing the slow down with a profiler and I found out that a shell exec called by envkeys-php's fetch() function was responsible, located at:

$res = rtrim(shell_exec($cmd));
)

The visualization of the profiler's results:
image

My analysis

I decided to try and debug it, and found out that this class ends up matching envkey-source binary for linux/amd64 when used inside the container, which runs a lot slower than the linux/arm64 binary on my machine of course.
I believe the cause of this behavior lies on the code (in the snipped bellow) that calls php_uname('m') to determine the cpu arch, but it can only match 'arm', while running uname -m inside the container yields 'aarch64'.

} elseif (stristr(PHP_OS, 'DARWIN') && stripos(php_uname('m'), 'arm') !== false) {

image

System Information

Hardware: MacBook Air
Chip: Apple M1 (aarch64)
Memory: 8 GB
OS: macOS 14.5 (Sonoma)

envkey-php version

2.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant