Project

General

Profile

Actions

Mejora #757

closed

Don't use Anonymous Inner Classes

Added by Federico Vera over 6 years ago. Updated over 6 years ago.

Status:
Resuelto
Priority:
Normal
Assignee:
Target version:
Start date:
2018-07-12
Due date:
2018-07-23
% Done:

100%

Estimated time:
Dificultad:
Tags:

Description

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.

Related issues 1 (0 open1 closed)

Blocks exp4j - Mejora #749: Hacer que las expresiones sean serializablesResueltoFederico Vera2018-07-092018-07-23

Actions
Actions #1

Updated by Federico Vera over 6 years ago

  • Blocks Mejora #749: Hacer que las expresiones sean serializables added
Actions #2

Updated by Federico Vera over 6 years ago

Changeset: fcc2589e815a5387a13c4d5b96f1c23e63e365b8
Author: Federico Vera
Date: 2018-07-12 08:37
Message: Make Funtions static inner classes instead of Anonymous Inner Clasess

Actions #3

Updated by Federico Vera over 6 years ago

Changeset: 6a5a3fe233668589c9225cda8afb2aa56862595c
Author: Federico Vera
Date: 2018-07-12 08:37
Message: Make Operators static inner classes instead of Anonymous Inner Clasess

Actions #4

Updated by Federico Vera over 6 years ago

Changeset: a3c3e9fa66ffcc0eb8d3ee22c43ed68bec61c236
Author: Federico Vera
Date: 2018-07-12 08:39
Message: Don't use an array as backend for Functions

Actions #5

Updated by Federico Vera over 6 years ago

Changeset: 5602321cc8d9ab93087e8b85d4bc7398af96c7a5
Author: Federico Vera
Date: 2018-07-12 09:08
Message: Don't use an array as backend for Operators

Actions #6

Updated by Federico Vera over 6 years ago

Changeset: d7b8e40ce99892c5a053ea53ae2f097a46fefb23
Author: Federico Vera
Date: 2018-07-12 09:14
Message: Make FunctionsMisc static inner classes instead of Anonymous Inner Clasess

Actions #7

Updated by Federico Vera over 6 years ago

Changeset: eb3062b6dde94f7caaa514bc6699ec2ba3031207
Author: Federico Vera
Date: 2018-07-12 09:25
Message: Make FunctionsBoolean static inner classes instead of Anonymous Inner Clasess

Actions #8

Updated by Federico Vera over 6 years ago

Changeset: 872320f62d7e7e90f8a92aaf0b1905d72a87dc98
Author: Federico Vera
Date: 2018-07-12 09:43
Message: Make OperatorsComparison static inner classes instead of Anonymous Inner Clasess

Actions #9

Updated by Federico Vera over 6 years ago

  • Status changed from Nuevo to Resuelto
  • % Done changed from 0 to 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 % |
+------------------------+---------------------------+--------------------------+

Actions #10

Updated by Federico Vera over 6 years ago

  • Tracker changed from Desarrollo to Mejora
Actions

Also available in: Atom PDF