Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x = 0;
- for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) {
- x += x + x + x + x + x;
- }
- System.out.println(x);
- public int slow() {
- String s = "x";
- for (int i = 0; i < 100000; ++i) {
- s += "x";
- }
- return 10;
- }
- #include <stdio.h> /* printf() */
- int factorial(int n) {
- return n == 0 ? 1 : n * factorial(n - 1);
- }
- int main() {
- int n = 10;
- printf("factorial(%d) = %dn", n, factorial(n));
- return 0;
- }
- factorial:
- .LFB13:
- testl %edi, %edi
- movl $1, %eax
- je .L3
- .p2align 4,,10
- .p2align 3
- .L4:
- imull %edi, %eax
- subl $1, %edi
- jne .L4
- .L3:
- rep
- ret
- main:
- .LFB14:
- subq $8, %rsp
- .LCFI0:
- movl $3628800, %edx
- movl $10, %esi
- movl $.LC0, %edi
- xorl %eax, %eax
- call printf
- xorl %eax, %eax
- addq $8, %rsp
- ret
- x = 0
- sleep 6 // Let's assume this is defined somewhere.
- print x
- int x = 1;
- int y = 1;
- int z = x - y;
- for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) {
- z += z + z + z + z + z;
- }
- System.out.println(z);
- extern int x; // defined elsewhere
- for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) {
- x += x + x + x + x + x;
- }
- return x;
- extern volatile int x; // defined elsewhere
- for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) {
- x += x + x + x + x + x;
- }
- return x;
- [js@HOST2 java]$ gcj --main=Optimize -O2 Optimize.java
- [js@HOST2 java]$ ./a.out
- 0
- [js@HOST2 java]$
- class Optimize {
- private static int doIt() {
- int x = 0;
- for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) {
- x += x + x + x + x + x;
- }
- return x;
- }
- public static void main(String[] args) {
- for(int i=0;i<5;i++) {
- doIt();
- }
- }
- }
- 1 java.lang.String::hashCode (60 bytes)
- 1% Optimize::doIt @ 4 (30 bytes)
- 2 Optimize::doIt (30 bytes)
- "starting windows"
- "enjoy freecell/solitaire"
- "shutting down windows"
- #include <stdio.h>
- int main()
- {
- int x = 0;
- for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) {
- x += x + x + x + x + x;
- }
- printf("%d", x);
- }
Add Comment
Please, Sign In to add comment