Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 963996a

Browse files
committed
Update to latest libsass version (3.2.0-beta.3)
Add benchmark options to cli and test runner
1 parent e68673b commit 963996a

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed

Build.PL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ my %config = (
211211
extend.cpp file.cpp output.cpp parser.cpp prelexer.cpp emitter.cpp position.cpp
212212
sass.cpp sass_interface.cpp sass_functions.cpp sass_values.cpp sass_context.cpp
213213
source_map.cpp to_c.cpp to_string.cpp units.cpp utf8_string.cpp util.cpp cssize.cpp
214-
contextualize_eval.cpp listize.cpp
214+
contextualize_eval.cpp listize.cpp lexer.cpp
215215
) ]
216216
},
217217
config => { ld => 'c++' }, # Need to link with a C++ linker since libsass is C++ (even though the .xs file is not)

bin/psass.pl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
# init options
4343
my $watchdog;
44+
my $benchmark;
4445
my $precision;
4546
my $output_file;
4647
my $output_style;
@@ -69,8 +70,9 @@ sub version {
6970
# get options
7071
GetOptions (
7172
'help|h' => sub { pod2usage(1); },
72-
'watch|w' => \ $watchdog,
73+
'watch|w!' => \ $watchdog,
7374
'version|v' => \ &version,
75+
'benchmark|b!' => \ $benchmark,
7476
'indent=s' => \ $indent,
7577
'linefeed=s' => \ $linefeed,
7678
'precision|p=s' => \ $precision,
@@ -117,6 +119,9 @@ sub version {
117119
if (defined $ARGV[1] && $ARGV[1] ne '-')
118120
{ $output_file = $ARGV[1]; }
119121

122+
# check if the benchmark module is available
123+
if ($benchmark && ! eval "use Benchmark; 1" )
124+
{ die "Error loading Benchmark module\n", $@; }
120125

121126
####################################################################################################
122127
# get sass standard option list
@@ -154,6 +159,9 @@ ()
154159
# variables
155160
my ($css, $err, $stats);
156161

162+
# get benchmark stamp before compiling
163+
my $t0 = $benchmark ? Benchmark->new : 0;
164+
157165
# open filehandle if path is given
158166
if (defined $ARGV[0] && $ARGV[0] ne '-')
159167
{
@@ -169,6 +177,11 @@ ()
169177
);
170178
}
171179

180+
# get benchmark stamp after compiling
181+
my $t1 = $benchmark ? Benchmark->new : 0;
182+
# only print benchmark result when module is available
183+
if ($benchmark) { print timestr(timediff($t1, $t0)), "\n"; }
184+
172185
# process return status values
173186
if (defined $css)
174187
{
@@ -233,6 +246,7 @@ =head1 SYNOPSIS
233246
-s, --source-map-contents include original contents
234247
-m, --source-map-file=file create and write source-map to file
235248
--no-source-map-url omit sourceMappingUrl from output
249+
--benchmark print benchmark for compilation time
236250
237251
=head1 OPTIONS
238252

lib/CSS/Sass/Watchdog.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ our @EXPORT = qw(start_watchdog); # symbols to export by default
2020
use List::MoreUtils qw(uniq);
2121

2222
# check if the benchmark module is available
23-
my $benchmark = eval { use Benchmark; 1 };
23+
my $benchmark = eval "use Benchmark; 1";
2424

2525
# declare package variables
2626
my ($parent_pid, $child_pid) = ($$, 0);

t/99_sass_specs.t

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ while (scalar(@running)) {
176176
} @running;
177177
}
178178

179+
# check if the benchmark module is available
180+
my $benchmark = eval "use Benchmark; 1" ;
181+
182+
# get benchmark stamp before compiling
183+
my $t0 = $benchmark ? Benchmark->new : 0;
184+
179185
foreach my $test (@tests)
180186
{
181187

@@ -296,7 +302,15 @@ foreach my $test (@tests)
296302
}
297303

298304
}
305+
306+
# get benchmark stamp after compiling
307+
my $t1 = $benchmark ? Benchmark->new : 0;
308+
299309
END {
310+
311+
# only print benchmark result when module is available
312+
if ($benchmark) { warn "\nin ", timestr(timediff($t1, $t0)), "\n"; }
313+
300314
foreach my $surprise (@surprises)
301315
{
302316
printf STDERR "surprise: %s\n", $surprise->[0];

t/sass-spec

Submodule sass-spec updated 167 files

0 commit comments

Comments
 (0)