summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-08-25 11:48:02 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-08-25 11:48:02 +0000
commit6d0ce49991a442e7e3f26c3922c26e54d927dd93 (patch)
treeb0c7a1ea8f6c6be4c4c4ef0761ae17b6f3900558 /src
parentaddes cache and log to a function, result of the test, no diference so remove... (diff)
downloadinkscape-6d0ce49991a442e7e3f26c3922c26e54d927dd93.tar.gz
inkscape-6d0ce49991a442e7e3f26c3922c26e54d927dd93.zip
Removed cache work :(
(bzr r13645.1.113)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-satellite.cpp78
-rw-r--r--src/helper/geom-satellite.h4
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp8
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h1
4 files changed, 3 insertions, 88 deletions
diff --git a/src/helper/geom-satellite.cpp b/src/helper/geom-satellite.cpp
index fac314b7f..547caf539 100644
--- a/src/helper/geom-satellite.cpp
+++ b/src/helper/geom-satellite.cpp
@@ -47,49 +47,8 @@ Satellite::~Satellite() {}
* TODO: find a better place to it
*/
-//http://stackoverflow.com/questions/1861294/how-to-calculate-execution-time-of-a-code-snippet-in-c
-/* Remove if already defined */
-typedef long long int64; typedef unsigned long long uint64;
-/* Returns the amount of milliseconds elapsed since the UNIX epoch. Works on both
- * windows and linux. */
-
-uint64 GetTimeMs64()
-{
-#ifdef _WIN32
- /* Windows */
- FILETIME ft;
- LARGE_INTEGER li;
-
- /* Get the amount of 100 nano seconds intervals elapsed since January 1, 1601 (UTC) and copy it
- * to a LARGE_INTEGER structure. */
- GetSystemTimeAsFileTime(&ft);
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
-
- uint64 ret = li.QuadPart;
- ret -= 116444736000000000LL; /* Convert from file time to UNIX epoch time. */
- ret /= 10000; /* From 100 nano seconds (10^-7) to 1 millisecond (10^-3) intervals */
-
- return ret;
-#else
- /* Linux */
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
-
- uint64 ret = tv.tv_usec;
- /* Convert from micro seconds (10^-6) to milliseconds (10^-3) */
- ret /= 1000;
-
- /* Adds the seconds (10^0) after converting them to milliseconds (10^-3) */
- ret += (tv.tv_sec * 1000);
-
- return ret;
-#endif
-}
-
-double timeAtArcLength(double const A, Geom::Curve const &curve_in, size_t cache_limit)
+double timeAtArcLength(double const A, Geom::Curve const &curve_in)
{
if ( A == 0 || curve_in.isDegenerate()) {
return 0;
@@ -97,38 +56,6 @@ double timeAtArcLength(double const A, Geom::Curve const &curve_in, size_t cache
//using "d2_in" for curve comparation, using directly "curve_in" crash in bezier compare function- dynamic_cast-
Geom::D2<Geom::SBasis> d2_in = curve_in.toSBasis();
-
- static bool cached = false;
- if(cache_limit == 0){
- cached = false;
- } else if(cache_limit > 1){
- cached = true;
- }
- static size_t count = 0;
- static uint64 start = GetTimeMs64();
- static uint64 time_diff = GetTimeMs64();
- static cache_item cache_value = std::make_pair(0.0, std::make_pair(A, d2_in));
- if(cache_limit > 1 || cache_limit == 0){
- uint64 end = GetTimeMs64();
- uint64 elapsed_ms = end-start;
- if(count == 0){
- time_diff = 0;
- } else if(elapsed_ms < 1000){
- time_diff += elapsed_ms;
- }
- std::cout << "counter:" << count << ", cached:" << cached << ", function:timeAtArcLength" << ", miliseconds:" << elapsed_ms << ", acumulated ms:" << time_diff << "\n";
- start = end;
- count++;
- return 1;
- }
- if(cached){
- if(cache_value.second.first == A){
- if(cache_value.second.second == d2_in ){
- return cache_value.first;
- }
- }
- }
-
double t = 0;
double length_part = curve_in.length();
if (A >= length_part || curve_in.isLineSegment()) {
@@ -142,9 +69,6 @@ double timeAtArcLength(double const A, Geom::Curve const &curve_in, size_t cache
t = t_roots[0];
}
}
- if(cached){
- cache_value = std::make_pair(t, std::make_pair(A, d2_in));
- }
return t;
}
diff --git a/src/helper/geom-satellite.h b/src/helper/geom-satellite.h
index 61ac6be75..2369dddbd 100644
--- a/src/helper/geom-satellite.h
+++ b/src/helper/geom-satellite.h
@@ -27,7 +27,7 @@ enum SatelliteType {
/**
* @brief Satellite a per ?node/curve holder of data.
*/
-typedef std::pair<double, std::pair<double, Geom::D2<Geom::SBasis> > > cache_item;
+
class Satellite {
public:
@@ -88,7 +88,7 @@ public:
size_t steps;
};
//cache_limit never called as 1
-double timeAtArcLength(double const A, Geom::Curve const &curve_in, size_t cache_limit = 1);
+double timeAtArcLength(double const A, Geom::Curve const &curve_in);
double arcLengthAt(double const A, Geom::Curve const &curve_in);
#endif // SEEN_SATELLITE_H
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index a83c7bbd5..4c325b7fa 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -55,7 +55,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject)
"ignore_radius_0", &wr, this, false),
helper_size(_("Helper size with direction:"),
_("Helper size with direction"), "helper_size", &wr, this, 0),
- cache(_("Cache size:"),_("Cache size"), "cache_size", &wr, this, 3),
pointwise(NULL)
{
registerParameter(&satellites_param);
@@ -69,7 +68,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject)
registerParameter(&ignore_radius_0);
registerParameter(&only_selected);
registerParameter(&hide_knots);
- registerParameter(&cache);
radius.param_set_range(0.0, Geom::infinity());
radius.param_set_increments(1, 1);
@@ -80,9 +78,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject)
helper_size.param_set_range(0, 999);
helper_size.param_set_increments(5, 5);
helper_size.param_set_digits(0);
- cache.param_set_range(0, 999);
- cache.param_set_increments(1, 1);
- cache.param_set_digits(0);
}
void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
@@ -382,10 +377,7 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
} else {
satellites_param.setHelperSize(helper_size);
}
- Geom::Curve const &first_curve = pathv.curveAt(0);
size_t number_curves = pathv.curveCount();
- //Activete cache
- timeAtArcLength(1, first_curve, number_curves * cache);
for (std::vector<Satellite>::iterator it = sats.begin();
it != sats.end();) {
if (it->is_time != flexible) {
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index 9c58ab66c..804709342 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -58,7 +58,6 @@ private:
BoolParam hide_knots;
BoolParam ignore_radius_0;
ScalarParam helper_size;
- ScalarParam cache;
Pointwise *pointwise;
Geom::PathVector _hp;