Mejora #757
cerrada
Don't use Anonymous Inner Classes
Añadido por Federico Vera hace más de 6 años.
Actualizado hace más de 6 años.
Fecha de inicio:
2018-07-12
Tags:
Descripción
There're some annoying issues when using Anonymous Inner Classes:
- Can't serialize (we actually need this)
- Not easily optimizable by compiler (since methods are overridable they are called using
invokedinamic
)
- Code seems confusing for some people.
Peticiones relacionadas
1 (0 abiertas — 1 cerrada)
- Añadido bloquea a Mejora #749: Hacer que las expresiones sean serializables
Changeset: fcc2589e815a5387a13c4d5b96f1c23e63e365b8
Author: Federico Vera [email protected]
Date: 2018-07-12 08:37
Message: Make Funtions static inner classes instead of Anonymous Inner Clasess
Changeset: 6a5a3fe233668589c9225cda8afb2aa56862595c
Author: Federico Vera [email protected]
Date: 2018-07-12 08:37
Message: Make Operators static inner classes instead of Anonymous Inner Clasess
Changeset: a3c3e9fa66ffcc0eb8d3ee22c43ed68bec61c236
Author: Federico Vera [email protected]
Date: 2018-07-12 08:39
Message: Don't use an array as backend for Functions
Changeset: 5602321cc8d9ab93087e8b85d4bc7398af96c7a5
Author: Federico Vera [email protected]
Date: 2018-07-12 09:08
Message: Don't use an array as backend for Operators
Changeset: d7b8e40ce99892c5a053ea53ae2f097a46fefb23
Author: Federico Vera [email protected]
Date: 2018-07-12 09:14
Message: Make FunctionsMisc static inner classes instead of Anonymous Inner Clasess
Changeset: eb3062b6dde94f7caaa514bc6699ec2ba3031207
Author: Federico Vera [email protected]
Date: 2018-07-12 09:25
Message: Make FunctionsBoolean static inner classes instead of Anonymous Inner Clasess
Changeset: 872320f62d7e7e90f8a92aaf0b1905d72a87dc98
Author: Federico Vera [email protected]
Date: 2018-07-12 09:43
Message: Make OperatorsComparison static inner classes instead of Anonymous Inner Clasess
- Estado cambiado de Nuevo a Resuelto
- % Realizado cambiado de 0 a 100
Listo, hubo unas cuantas mejoras en performance:
Performance¶
In Java 8¶
Running net.objecthunter.exp4j.PerformanceTest
+------------------------+---------------------------+--------------------------+
| Implementation | Calculations per Second | Percentage of Math |
+------------------------+---------------------------+--------------------------+
| Java Math | 3368046.50 | 100.0000 % |
| exp4j | 1524782.00 | 45.2720 % |
| exp4j simplified | 1643364.50 | 48.7928 % |
| JSR-223 (Java Script) | 1375017.00 | 40.8254 % |
+------------------------+---------------------------+--------------------------+
In Java 10¶
Running net.objecthunter.exp4j.PerformanceTest
+------------------------+---------------------------+--------------------------+
| Implementation | Calculations per Second | Percentage of Math |
+------------------------+---------------------------+--------------------------+
| Java Math | 3183812.50 | 100.0000 % |
| exp4j | 1856690.00 | 58.3166 % |
| exp4j simplified | 2016287.50 | 63.3293 % |
| JSR-223 (Java Script) | 1810797.50 | 56.8751 % |
+------------------------+---------------------------+--------------------------+
- Tipo cambiado de Desarrollo a Mejora
Exportar a: Atom
PDF
Volver al inicio