# Accelerate Python by Re-Writing it in JavaScript
*by [@bwasti](https://twitter.com/bwasti)*
****
Here's some Python, it runs in 1 minute and 47 seconds on my machine.
```python
def is_prime(n: int):
result = True
for k in range(2, int(n ** 0.5) + 1):
if n % k == 0:
result = False
break
return result
def count_primes(n: int) -> int:
count = 0
for k in range(2, n):
if is_prime(k):
count += 1
return count
print(count_primes(10000000))
```
Here's the same code in JavaScript. It runs about **71x faster**. 1.486 seconds.
```javascript
function is_prime(n) {
let result = true
for (let k = 2; k < Math.floor(Math.sqrt(n) + 1); k++) {
if (n % k === 0) {
result = false
break
}
}
return result
}
function count_primes(n) {
let count = 0
for (let k = 2; k < n; k++) {
if (is_prime(k)) {
count += 1
}
}
return count
}
console.log(count_primes(10000000))
```